using Domain.Entities.Enums;
using System;

namespace Domain.Entities
{
    [Serializable]
    public class GroupForumPermission : ForumPermission
    {
        private Group group;

        public virtual Group Group
        {
            get { return group; }
            internal set { group = value; }
        }

        public override bool Equals(object other)
        {
            if (this == other)
            {
                return true;
            }

            if (other == null || GetType() != other.GetType())
            {
                return false;
            }

            GroupForumPermission o = other as GroupForumPermission;
            if (!group.Equals(o.Group) || !forum.Equals(o.Forum))
            {
                return false;
            }

            return true;
        }

        public override int GetHashCode()
        {
            return group.GetHashCode() ^ forum.GetHashCode();
        }
    }
}
